import { RouteRecordRaw } from 'vue-router';
import {  SessionStorage } from 'quasar'

const routes: RouteRecordRaw[] = [
	{
		path: '/',
		component: () => import('layouts/MainLayout.vue'),
		children: [
			{ path: '', component: () => import('pages/Index.vue') },
			{ path: 'list', component: () => import('pages/common/List.vue') },
			{ path: 'Type', component: () => import('pages/common/Type.vue') },
			{ path: 'Detail', component: () => import( 'pages/common/Detial.vue') },
			{ path: 'Add', component: () => import( 'pages/common/Add.vue') },
			{ path: 'Relation', component: () => import( 'pages/common/Relation.vue') },
			{ path: 'Update', component: () => import('pages/common/Update.vue') },
			{ path: 'Option', component: () => import('pages/common/Option.vue') },
			{ path: 'activityDetails', component: () => import('pages/common/activityDetails.vue') },
			{ path: 'Permissions', component: () => import('pages/common/Permissions.vue') },
      { path: 'addOrders', component: () => import('pages/Orders/addOrders.vue') },
      { path: 'BatchPrice',component: () => import('pages//common/BatchPrice.vue')}
    ]
	},
	{
		path: '/cReport',
		component: () => import('pages/detectionReport.vue')
	},
	{
		path: '/login',
		component: () => import('pages/Login.vue')
	},
	{
		path: '/register',
		component: () => import('pages/Register.vue')
	},
  {
    path: '/kungfu',
    component: () => import('layouts/Kungfu.vue'),
    children: [
      { path: 'cert', component: () => import('pages/kungfu/Cert.vue') },
      { path: 'report', component: () => import('pages/kungfu/Report.vue') },
    ]
  },
  {
    path: '/tree',
    component: () => import('pages/tree/TreePage.vue')
  },
  { path: '/downloadSample', component: () => import('pages/json2excel/Sample.vue') },
	// Always leave this as last one,
	// but you can also remove it
	{
		path: '/:catchAll(.*)*',
		component: () => {
      const item = SessionStorage.getItem("errorTimes");
      if (item === undefined) {
        SessionStorage.set("errorTimes",0)
      }
      let number = Number(item)
      number ++
      SessionStorage.set("errorTimes",number)
      if (number % 4 == 0) {
        return  import('pages/Error404Horror.vue')
      } else {
        window.location.href = '404Cyberpunk.html'
      }
    }
	},
  {
    path: '/report',
    component: () => import('pages/report/Layout.vue'),
    children: [
      { path: 'report', component: () => import('pages/report/Report.vue') },
      { path: 'reportPaint', component: () => import('pages/report/ReportPaint.vue') },
      { path: 'reportDetail', component: () => import('pages/report/ReportDetail.vue') },
      { path: 'reportPaintDetail', component: () => import('pages/report/ReportPaintDetail.vue') },
      { path: 'reportSanwu', component: () => import('pages/report/SanwuCert.vue') },
      { path: 'reportCover', component: () => import('pages/report/ReportCover.vue') },
      { path: 'reportBlank', component: () => import('pages/report/ReportBlank.vue') },
    ]
  },
  {
    path: '/applet',
    component: () => import('pages/applet/Layout.vue'),
    children: [
      { path: 'report', component: () => import('pages/applet/Report.vue') },
    ]
  },
  {
    path: '/weapp',
    component: () => import('pages/weapp/Layout.vue'),
    children: [
      { path: 'report', component: () => import('pages/weapp/WeReport.vue') },
      { path: 'img', component: () => import('pages/weapp/Imgs.vue') }
    ]
  },
  {
    path: '/',
    component: () => import('layouts/BlankLayout.vue'),
    children: [
      { path: 'WeAppPage', component: () => import('pages/WeAppPage.vue') },
    ]
  },
  {
    path: '/test',
    component: () => import('pages/test.vue')
  },
];

export default routes;
